<template>
  <div>
    <p v-if="phone">
      {{phone}}
    </p>
    <p @click="toLogin" v-else>
      登录/注册
    </p>
  </div>
</template>

<script>
export default {
  data () {
    return {
      phone:  localStorage.getItem('phone')
    }
  },
  methods: {
    toLogin () {
      localStorage.setItem('fromPath', this.$route.fullPath)
      this.$router.push('/login')
    }
  }
}
</script>

<style>

</style>